package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the orders database table.
 * 
 */
@Entity
@Table(name="orders")
@NamedQuery(name="Order.findAll", query="SELECT o FROM Order o")
public class Order implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int id;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="ACCEPT_DATE")
	private Date acceptDate;

	private String acceptedby;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="CREATE_DATE")
	private Date createDate;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="END_DATE")
	private Date endDate;

	private String status;

	//bi-directional many-to-one association to OrdersPlue
	@OneToMany(mappedBy="order")
	private List<OrdersPlue> ordersPlues;

	//bi-directional many-to-many association to Plue
	@ManyToMany
	@JoinTable(
		name="orders_plues"
		, joinColumns={
			@JoinColumn(name="ORDER_ID")
			}
		, inverseJoinColumns={
			@JoinColumn(name="PLU_ID")
			}
		)
	private List<Plue> plues;

	public Order() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getAcceptDate() {
		return this.acceptDate;
	}

	public void setAcceptDate(Date acceptDate) {
		this.acceptDate = acceptDate;
	}

	public String getAcceptedby() {
		return this.acceptedby;
	}

	public void setAcceptedby(String acceptedby) {
		this.acceptedby = acceptedby;
	}

	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getEndDate() {
		return this.endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public List<OrdersPlue> getOrdersPlues() {
		return this.ordersPlues;
	}

	public void setOrdersPlues(List<OrdersPlue> ordersPlues) {
		this.ordersPlues = ordersPlues;
	}

	public OrdersPlue addOrdersPlue(OrdersPlue ordersPlue) {
		getOrdersPlues().add(ordersPlue);
		ordersPlue.setOrder(this);

		return ordersPlue;
	}

	public OrdersPlue removeOrdersPlue(OrdersPlue ordersPlue) {
		getOrdersPlues().remove(ordersPlue);
		ordersPlue.setOrder(null);

		return ordersPlue;
	}

	public List<Plue> getPlues() {
		return this.plues;
	}

	public void setPlues(List<Plue> plues) {
		this.plues = plues;
	}

}